



//
//  MBNewsDetailVC.m
//  房源详情-小区详情
//
//  Created by MB__Lee on 2018/5/29.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "MBNewsDetailVC.h"

#import "MBNewsDetailsModel.h"
#import <MJExtension.h>

#import "MBNavigationLeftBar.h"

@interface MBNewsDetailVC ()<UIWebViewDelegate>

@property(nonatomic,strong)UIWebView *webview;

@property(nonatomic,strong)MBNavigationLeftBar *bar;
@end

@implementation MBNewsDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // Do any additional setup after loading the view.
    [self.view addSubview: self.webview];
    
    self.title = @"新闻";
    
    [self setNavigationBar];
}
-(void)setNavigationBar{
    
    MBNavigationLeftBar *bar  = [[MBNavigationLeftBar alloc] init];
    _bar = bar;
    [bar MBNavigationLeftBar_withVC:self];
    
}
-(UIWebView *)webview{
    if (!_webview) {
        
        CGRect frame = self.view.bounds;
        frame.origin.y -= 0;
        frame.size.height += 0;
        
        _webview = [[UIWebView alloc] initWithFrame:frame];
        
        
        _webview.delegate = self;
    }
    return  _webview;
}
-(void)setSn:(NSString *)sn{
    _sn = sn;
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    dict[@"sn"]  = sn;
    
    [MBNetTool MBPost:News_info paramater:dict success:^(id response) {
        
        if ([response[@"code"] integerValue] == 10000) {
            
            MBNewsDetailsModel *model = [MBNewsDetailsModel mj_objectWithKeyValues:response[@"data"]];
            NSURLRequest *request  = [NSURLRequest requestWithURL:[NSURL URLWithString:model.href]];
            [self.webview loadRequest:request];
            
        }

    } failure:^(NSError *error) {
        
    }];
    
    
    
}

#pragma mark --UIWebViewDelegate
-(void)webViewDidStartLoad:(UIWebView *)webView{
    
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
